package com.qianyu.project.core.context.user;

import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author gs
 * @date create in 2021/1/8 22:18
 */
@Component
public class FlowUserProvider implements FlowUserManager {

    private Map<String, SysUser> sysUserMap = new HashMap<>();
    private SysUser sysUser;

    @Override
    public SysUser getFlowUser() {
        return this.sysUser;
    }

    @Override
    public void pushSysUser(SysUser sysUser) {
        this.sysUserMap.put(sysUser.getUsername(), sysUser);
    }

    @Override
    public void setSysUser(String username) {
        this.sysUser = this.sysUserMap.get(username);
    }

    @Override
    public void removeSysUser(String username) {
        this.sysUserMap.remove(username);
    }
}
